package com.example.nonacademic_education.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.nonacademic_education.data.request.TheClassList;
import com.example.nonacademic_education.data.response.TheClassAllDto;
import com.example.nonacademic_education.data.response.TheClassDto;
import com.example.nonacademic_education.entity.TheClass;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @Author:yanghua
 * @Date:2023/4/18 22:27
 */
public interface TheClassDao extends BaseMapper<TheClass> {
    @Update("update theclass set is_del = 1 where id=#{id}")
    Integer deleteOne(Long id);

    List<TheClassAllDto> getList(TheClassList theClassList);

    Integer getNumber(TheClassList theClassList);

    List<TheClassDto> getIdAndName(TheClassList theClassList);

    @Select("select project_id from theclass where id = #{classId} ;")
    Long getProjectIdById(Long classId);

    @Select("select name from theclass where id = #{classId}")
    String getName(Long classId);

    @Select("select training_info from theclass where id = #{classId}")
    String getTrainingInfo(Long classId);

    @Update("update theclass set training_info=#{trainingInfo} where id=#{classId}")
    Integer updateGraduateInfo(String trainingInfo, Long classId);

    @Select("select * from theclass where id = #{classId}")
    TheClass getOneById(Long classId);

    @Update("update theclass set is_del=1 where project_id=#{id}")
    Integer deleteByProjectId(Long id);

    @Update("update theclass set training_info=#{trainingInfo} where id=#{classId}")
    Integer addTrainingInfoByClassId(String trainingInfo, Long classId);
}
